<template>
	<!-- 我的-我的服务-收藏 -->
	<view class="collect public">
		<view class="empty"></view>
		<template v-if="count != 0">
			<view class="main">
				<view class="main-item" v-for="item in arr.list" :key="item.site_id" @click="Jumpshop(item)">
					<template>
						<view>
							<view class="main-item-header">
								<view class="trademark">
									<!-- <image :src="item.trademark" mode=""></image> -->
									<image :src="$image + item.logo" mode=""></image>
								</view>
								<view class="main-item-header-right">
									<view class="MerchantName flexjcsb">
										<view class="">
											<!-- {{item.MerchantName}} -->
											{{item.site_name}}
										</view>
										<view class="flexjcc">
											校园专送
										</view>
									</view>
									<view class="RatingSales">
										<view class="RatingSales-score">
											<view class="">
												<uni-rate :max="1" size="19rpx" color="#c6c6c6" />
											</view>
											<view class="">
												<!-- {{item.score}} -->
												{{item.shop_deliverycredit}}
											</view>
										</view>
										<view class="RatingSales-MonthlySales">
											<!-- 月销&ensp;{{item.MonthlySales}} -->
											月销&ensp;{{item.shop_sales}}
										</view>
									</view>
									<view class="deliver flexjcsb">
										<view class="deliver-left">
											<view class="">
												起送{{item.start_money | filterPrice}}
											</view>
											<view class="">
												配送{{item.delivery_money | filterPrice}}
											</view>
										</view>
										<view class="deliver-right">
											距我{{item.distance}}km
										</view>
									</view>
									<view class="preferential flexjcc" v-if="fullReduction == []">
										<view v-for="(i,index) in fullReduction" :key="index">满{{ i.money }}减{{ i.discount_money }}</view>
									</view>
								</view>
							</view>
							<!-- <view class="main-item-footer">
								<view class="shop_bottom">
									<view class="describeContent" v-for="i in item.child" :key="i.id">
										<image :src="i.foodImage" mode=""></image>
										<view class="describe">
											{{i.foodTitle}}
										</view>
										<view class="price">
											<text class="pri_o">{{i.price | filterPrice}}</text>
											<text class="pri_t">{{i.originalPrice | filterPrice}}</text>
										</view>
									</view>
								</view>
							</view> -->
						</view>
					</template>
					<template>
						<view>
							<!-- main-item -->
							<!-- <view class="">
								<view class="main-item-meal">
									<view class="meal-header">
										<view class="foodImage">
											<image
												src="https://www.anxjm.com/storage/uploads/image/2020/06/28/517e281a15aff7181e16544cfb511581.jpg"
												mode=""></image>
												<image :src="'http://songcan.xing-peng.com/' + item.logo" mode=""></image>
										</view>
										<view class="meal-header-right">
											<view class="meal-header-right-title">
												{{item.site_name}}
											</view>
											<view class="MonthlySales">
												月销&ensp;<text>{{item.shop_sales}}</text>
											</view>
											<view class="meal-header-price">
												<view class="">
													￥<text>{{item.price}}</text>
												</view>
												<view class="">
													￥16
												</view>
											</view>
										</view>
									</view>
									<view class="meal-footer">
										<view class="meal-footer-notes flexjcsb">
											<view class="meal-footer-notes-left">
												<view class="">
													商家店铺名称
												</view>
												<view class="score">
													<uni-rate :max="1" size="19rpx" color="#c6c6c6" />
													<text>4.5</text>
												</view>
											</view>
											<view class="deliver">
												<text>起送￥{{item.start_money}}</text>
												<text>配送￥{{item.delivery_money}}</text>
											</view>
										</view>
									</view>
								</view>
							</view> -->
						</view>
					</template>
				</view>
				<!-- <view class="main-item">
					<view class="main-item-meal">
						<view class="meal-header">
							<view class="foodImage">
								<image
									src="https://www.anxjm.com/storage/uploads/image/2020/06/28/517e281a15aff7181e16544cfb511581.jpg"
									mode=""></image>
							</view>
							<view class="meal-header-right">
								<view class="meal-header-right-title">
									咖喱鸡肉盖饭
								</view>
								<view class="MonthlySales">
									月销&ensp;237
								</view>
								<view class="meal-header-price">
									<view class="">
										￥<text>12.00</text>
									</view>
									<view class="">
										￥16
									</view>
								</view>
							</view>
						</view>
						<view class="meal-footer">
							<view class="meal-footer-notes flexjcsb">
								<view class="meal-footer-notes-left">
									<view class="">
										商家店铺名称
									</view>
									<view class="score">
										<uni-rate :max="1" size="19rpx" color="#c6c6c6" />
										<text>4.5</text>
									</view>
								</view>
								<view class="deliver">
									<text>起送￥15</text>
									<text>配送￥2</text>
								</view>
							</view>
						</view>
					</view>
				</view> -->
			</view>
		</template>
		<template v-else>
			<view>
				<image style="width: 750rpx;height: 750rpx;" src="https://img.zcool.cn/community/01d29258cce264a801219c77ec3f60.png" mode=""></image>
			</view>
		</template>
	</view>
</template>

<script>
	const $api = require('@/utils/request.js').API
	export default {
		data() {
			return {
				arr: [],
				fullReduction:[],
				$image: this.$image,
				count: 0,
			}
		},
		onShow() {
			this.collectShopList()
		},
		methods: {
			collectShopList() {
				$api.postCollectShopList({}).then(res => {
					if (res.data.code == 0) {
						this.arr = res.data.data
						this.count = res.data.data.count
						this.storeFullReduction(res.data.data.list)
					}
				})
			},
			storeFullReduction(item){
				let site_id = 0
				item.forEach(item => {
					site_id = item.site_id
				});
				$api.postStoreFullReduction({
					site_id: site_id
				}).then(res => {
					this.fullReduction = res.data.data
				})
			},
			Jumpshop(item){
				uni.navigateTo({
					url:'/pages_order/order/order?site_id=' + item.site_id
				})
			},
		},
		filters: {
			filterPrice(e) {
				return '￥' + e
			}
		}
	}
</script>

<style lang="less" scoped>
	.collect {
		font-size: 20rpx;
		font-family: PingFang SC;
		font-weight: 400;
		color: #989898;
		background: #F3F3F3;
		// 空
		.empty {
			height: 16rpx;
		}

		.main {
			width: 702rpx;
			margin: auto;

			.main-item {
				border-radius: 10rpx;
				padding-bottom: 31rpx;
				background: #FFFFFF;
				margin-bottom: 10rpx;

				.main-item-header {
					display: flex;

					.trademark {
						image {
							width: 148rpx;
							height: 146rpx;
							border-radius: 10rpx;
							padding: 16rpx 20rpx 0 20rpx;
						}
					}

					.main-item-header-right {
						width: 100%;

						.MerchantName {
							view:first-child {
								font-size: 30rpx;
								font-weight: 500;
								padding: 23rpx 0 14rpx 0;
							}

							view:last-child {
								width: 120rpx;
								height: 35rpx;
								background: #F14500;
								border-radius: 5rpx;
								font-size: 18rpx;
								color: #FFFFFF;
								margin-right: 25rpx;
							}
						}

						.RatingSales {
							display: flex;

							.RatingSales-score {
								display: flex;
								align-items: center;

								view:first-child {
									padding-right: 6rpx;
								}
							}

							.RatingSales-MonthlySales {
								padding-left: 12rpx;
							}
						}

						.deliver {
							padding-bottom: 14rpx;

							.deliver-left {
								display: flex;

								view:first-child {
									padding-right: 12rpx;
								}
							}

							.deliver-right {
								padding-right: 30rpx;
							}
						}

						.preferential {
							width: 130rpx;
							height: 32rpx;
							border: 1px solid #EB1D1D;
							border-radius: 5rpx;
							font-size: 18rpx;
							color: #E31212;
						}
					}
				}

				.main-item-footer {

					.shop_bottom {
						width: 529rpx;
						overflow-x: scroll;
						display: flex;
						margin-top: 25rpx;
						margin-left: 170rpx;

						// margin-bottom: 31rpx;
						.describeContent {
							display: flex;
							flex-direction: column;
							align-items: flex-start;
							justify-content: space-around;
							padding: 6rpx;
							width: 157rpx;
							height: 186rpx;
							background: #FFFFFF;
							border: 1px solid #F9F9F9;
							border-radius: 10rpx;
							margin-right: 6rpx;

							image {
								width: 142rpx;
								height: 111rpx;
								border-radius: 10rpx 10rpx 0rpx 0rpx;
							}

							.describe {
								font-size: 18rpx;
								font-family: PingFang SC;
								font-weight: 500;
								color: #161415;
							}

							.price {
								font-size: 20rpx;
								font-family: PingFang SC;
								font-weight: 500;
								color: #3A3A3A;
							}

							.pri_t {
								font-size: 18rpx;
								font-family: PingFang SC;
								font-weight: 400;
								text-decoration: line-through;
							}
						}
					}
				}

				.main-item-meal {
					.meal-header {
						display: flex;

						.foodImage {
							image {
								width: 148rpx;
								height: 148rpx;
								border-radius: 10rpx;
								padding: 17rpx 20rpx;
							}
						}

						.meal-header-right {
							.meal-header-right-title {
								font-size: 30rpx;
								font-family: PingFang SC;
								font-weight: 500;
								color: #161415;
								padding: 24rpx 0 14rpx 0;
							}

							.meal-header-price {
								display: flex;
								align-items: baseline;
								padding-top: 15rpx;

								view:first-child {
									font-size: 21rpx;
									font-family: PingFang SC;
									font-weight: 500;
									color: #E54100;

									text {
										font-size: 36rpx;
									}
								}

								view:last-child {
									font-size: 24rpx;
									font-family: PingFang SC;
									font-weight: 400;
									text-decoration: line-through;
									color: #808080;
									padding-left: 18rpx;
								}
							}
						}
					}

					.meal-footer {
						.meal-footer-notes {
							.meal-footer-notes-left {
								display: flex;
								padding-left: 26rpx;

								.score {
									display: flex;
									align-items: center;
									padding-left: 18rpx;
								}
							}

							.deliver {
								font-size: 20rpx;
								font-family: PingFang SC;
								font-weight: 400;
								color: #989898;
								padding-right: 37rpx;

								text:last-child {
									padding-left: 15rpx;
								}
							}
						}
					}
				}
			}
		}
	}
</style>